import { NoSkinCellRenderer } from "../../common/item/NoSkinCellRenderer";
import { Dispatcher } from "../../../../mvc/core/Dispatcher";
import { DataEvent } from "../../../events/DataEvent";
import { EventName } from "../../../mvc/EventName";
import { SLadderBattle } from "../../../../../Message/Public/SLadderBattle";
import { EntityUtil } from "../../../scene/layer/utils/EntityUtil";
import { GlobalStyle } from "../../../../common/global/GlobalStyle";
import { ObjCreate } from "../../common/ObjCreate";
import { ImagesConst } from "../../../resource/ImagesConst";
import { Language } from "../../../../../extend/language/Language";
import { GTextFiledBitmap } from "../../../../../com/mui/controls/GTextFiledBitmap";
//class LadderBattlefieldGuardRenderer
    
    export  class LadderBattlefieldGuardRenderer extends NoSkinCellRenderer
    {
        constructor()
        {
            super();
            return;
        }

        /* internal  */clickGuardBtn(arg1: Object /* flash.events.MouseEvent */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.LadderBattlefieldEnter, this._vo.ladderId));
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            super.data = arg1;
            if (typeof arg1 === "sladderbattle") 
            {
                this._vo = arg1 as SLadderBattle;
                this._lName.htmlText = EntityUtil.getProxyNameByProxyAndServer(this._vo.playerOne.entityId.type, this._vo.playerOne.entityId.typeEx) + this._vo.playerOne.name;
                this._rName.htmlText = EntityUtil.getProxyNameByProxyAndServer(this._vo.playerTwo.entityId.type, this._vo.playerTwo.entityId.typeEx) + this._vo.playerTwo.name;
            }
            return;
        }

        protected /* override */ createChildren(): void
        {
            var loc1=GlobalStyle.setTextFormatAlign(GlobalStyle._textFormat2, flash.text.TextFormatAlign.CENTER);
            this._lName = ObjCreate.createGTextFiledBitmap("", 0, 13, 170, 20, this, loc1);
            this._rName = ObjCreate.createGTextFiledBitmap("", 200, 13, 170, 20, this, loc1);
            ObjCreate.createGBitmap(ImagesConst.ArenaVS, 170, 0, this);
            ObjCreate.createGButton(Language.getString(28824), 370, 10, 49, 24, this, "Button", this.clickGuardBtn);
            return;
        }

        /* internal */ /* var */_lName: GTextFiledBitmap;

        /* internal */ /* var */_rName: GTextFiledBitmap;

        /* internal */ /* var */_vo: SLadderBattle;
    }
